package Day01;

import java.util.Scanner;

/**
 * @author feng
 * @Date 2021/9/24 8:52
 *  回文数的判断
 */
public class Test02 {
    public static void main(String[] args) {
        System.out.println("输入字符串:");
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        if (ispanlid(s)){
            System.out.println("是回文数" + s);
        }else {
            System.out.println("不是回文数" + s);
        }


    }

    public static boolean ispanlid(String s){
        int low = 0;
        int high = s.length()-1;
        while (low < high){
            if (s.charAt(low) != s.charAt(high)){
                return false;
            }
            low++;
            high--;
        }
        return true;

    }
}
